<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>猜数字</title>
</head>
<body>
    <script>
        var num = Math.random()*100+1;
        num = Math.floor(num);

        var guessNum =prompt("请输入您猜测的数字 0-100");
        var frequency = 0;
        while(guessNum!=num&&frequency<6){
            if(guessNum>num){
                guessNum = prompt("大了");
            }
            if(guessNum<num){
                guessNum = prompt("小了");
            }
            frequency++;
        }
        if(guessNum==num){
            alert("回答正确");
        }else{
            alert("回答错误，游戏结束");
        }
        

    
    </script>
</body>
</html>